package com.carepad.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.carepad.dao.RecordItemsGroupMapper;
import com.carepad.entity.RecordItemsGroup;
import com.carepad.service.RecordItemsGroupService;
import com.carepad.util.Pager;

@Service("recordItemsGroupService")
public class RecordItemsGroupServiceImpl extends AbstractListService implements
		RecordItemsGroupService {

	@Autowired
	private RecordItemsGroupMapper recordItemsGroupMapper;

/*	@Override
	public RecordItemsGroup findById(Integer uid) {
		return recordItemsGroupMapper.selectByPrimaryKey(uid);
	}

	@Override
	public int save(RecordItemsGroup entity) {
		return recordItemsGroupMapper.insert(entity);
	}

	@Override
	public int update(RecordItemsGroup entity) {
		return recordItemsGroupMapper.updateByPrimaryKeySelective(entity);
	}

	@Override
	public int delete(Integer id) {
		return recordItemsGroupMapper.deleteByPrimaryKey(id);
	}*/

/*
	@Override
	public ExistValidationEnum validateRecordItemsGroupName(String recordItemsGroupName) {
		List<RecordItemsGroup> list = recordItemsGroupMapper.findByGroupName(recordItemsGroupName);

		if (list == null || list.size() == 0) {
			return ExistValidationEnum.NOT_EXIST;
		} else if (list.size() == 1) {
			return ExistValidationEnum.EXIST;
		} else {
			return ExistValidationEnum.MULTIPLE_EXIST;
		}
	}

	@Override
	public ExistValidationEnum validateRecordItemsGroupName(String groupName,Integer id) {
		List<RecordItemsGroup> list = recordItemsGroupMapper.findGroupNameNotWithId(groupName,id);
		
		if (list == null || list.size() == 0) {
			return ExistValidationEnum.NOT_EXIST;
		} else if (list.size() == 1) {
			return ExistValidationEnum.EXIST;
		} else {
			return ExistValidationEnum.MULTIPLE_EXIST;
		}
	}*/

	@Override
	public Pager viewPaginatedActiveList(Integer start, Integer size) {
		
		prepare(start, size);
		
		try {
			pager.setTotal(recordItemsGroupMapper.countAll());
			pager.setList(recordItemsGroupMapper.findListPaginated(start, size));
			
		} catch (Exception e) {
			// logger
			e.printStackTrace();
		}

		return pager;
	}

	@Override
	public List<RecordItemsGroup> findRecordItemsGroupList() {
		return recordItemsGroupMapper.findRecordItemsGroupList();
	}

	@Override
	public List<RecordItemsGroup> findAll() {
		
		return null;
	}

	@Override
	public List<RecordItemsGroup> findAllNotDisabled() {
		
		return null;
	}

	@Override
	public List<RecordItemsGroup> findAllDisabled() {
		
		return null;
	}

	@Override
	public RecordItemsGroup findById(Integer id) {
		
		return null;
	}

	@Override
	public int save(RecordItemsGroup entity) {
		
		return 0;
	}

	@Override
	public int update(RecordItemsGroup entity) {
		
		return 0;
	}

	@Override
	public int delete(RecordItemsGroup entity) {
		
		return 0;
	}

	@Override
	public int delete(Integer id) {
		
		return 0;
	}

	@Override
	public int save(RecordItemsGroup entity, Integer systemUserID) {
		
		return 0;
	}

	@Override
	public int update(RecordItemsGroup entity, Integer systemUserID) {
		
		return 0;
	}

}
